package com.train.extendsThread;
/**
 * 运行：调用{@link Thread#start()}方法启动线程
 * */
public class RunThread {
    public static void main(String[] args) {
        ExtendsThread thread_0 = new ExtendsThread("thread_0",1);
        ExtendsThread thread_1 = new ExtendsThread("thread_1",2);
        ExtendsThread thread_2 = new ExtendsThread("thread_2",3);
        ExtendsThread thread_3 = new ExtendsThread("thread_3",4);

        thread_0.start();
        thread_1.start();
        thread_2.start();
        thread_3.start();
//        thread_2();
    }
     /**
     * 如果懒得写那么多代码，也可以这样操作
     * */
    public static void thread_2(){
        new Thread(()->{
            for (int i = 0; i < 100; i++) {
                System.out.println(Thread.currentThread().getName()+":"+i);
            }
        },"thread_1").start();
        new Thread(()->{
            for (int i = 0; i < 100; i++) {
                System.out.println(Thread.currentThread().getName()+":"+i);
            }
        },"thread_2").start();
        new Thread(()->{
            for (int i = 0; i < 100; i++) {
                System.out.println(Thread.currentThread().getName()+":"+i);
            }
        },"thread_3").start();
    }
}